//
//@File    :	6.14_cingolf.cpp
//@Time    :	2021/08/08 18:29:11
//@Auther  :	Sun Sheng
//@Contact :	970340843@qq.com
//@Desc    :	non-numerica input skipped
//

#include <iostream>
const int Max = 5;
int main()
{
    using namespace std;
    int golf[Max];
    cout << "Please enter your golf scores.\n";
    cout << "You must enter " << Max << " rounds.\n";
    int i;
    for (i = 0; i < Max; i++)
    {
        cout << "round #" << i + 1 << ": ";
        while (!(cin >> golf[i]))
        {
            cin.clear();
            while (cin.get() != '\n')
            {
                continue;
            }
            cout << "Please enter a number: ";
        }
    }
    double total = 0.0;
    for (i = 0; i < Max; i++)
    {
        total += golf[i];
    }
    cout << total / Max << " = average score "
         << Max << " rounds\n";
    system("pause");
    return 0;
}